<!--
author: 何其沆(pooky)
desc: Search2封装 - 适用于Others - Statistics
date: 2021-11-12
-->
<template>
  <e-container class="page-search-components" @keyup.enter="handleEnter">
    <slot></slot>
    <div v-if="isSearchShow" class="buttons">
      <a-button class="secondary" @click="handleSearch">Search</a-button>
    </div>
  </e-container>
</template>

<script setup>
import EContainer from '@/components/EContainer.vue'
defineProps({
  isSearchShow: {
    type: Boolean,
    default: true
  }
})

const emits = defineEmits(['search'])
const handleSearch = () => emits('search')
const handleEnter = event => {
  if (event.target.tagName === 'INPUT') {
    emits('search')
  }
}
</script>

<style lang="less" scoped>
.page-search-components {
  position: relative;
  min-height: 106px;
  .buttons {
    position: absolute;
    right: 0;
    bottom: 0;
  }
}
</style>
